package com.aaron.guide.proxystudy.jdkProxy;

import java.lang.reflect.Proxy;

/**
 * @ClassName JdkProxyFactory
 * @description:
 * @author: 荣燊
 * @create: 2021-05-18 15:40
 **/
public class JdkProxyFactory {
    //o是前面传过来的实际的接口实现类
    public static Object getProxy(Object o) {
        //这里的Proxy属于
        return Proxy.newProxyInstance(
                o.getClass().getClassLoader(), //目标类的加载
                o.getClass().getInterfaces(), //代理需要实现的接口
                new MyInvocationHandler(o) //o:某个接口实现类
                );
    }
}
